#!/bin/bash

read -p "please input you want to monitor server's ip address:" m_ip

read -p "please input the port:" m_port

while :
do
	if nc -w 2 -z $m_ip $m_port
	then
		echo "$m_ip $m_port is opened"
	else
		echo "$m_ip $m_port is closed"
	fi
	sleep 1
done
